package com.jrowny.mediators
{
	import com.jrowny.enum.Notes;
	
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;
	import components.Preview;
	
	public class PreviewAreaMediator extends Mediator
	{
		public static const NAME:String = "PreviewAreaMediator";
		public function PreviewAreaMediator(viewComponent:Object=null)
		{
			super(NAME, viewComponent);
		}
		
		public function get previewArea():Preview{
			return viewComponent as Preview;
		}
		
		
		/**
		 * handle notifications
		 **/
		override public function listNotificationInterests():Array{
			return [Notes.CSS_HTML_GENERATED]
		}
		override public function handleNotification(notification:INotification):void{
			switch(notification.getName()){
				case Notes.CSS_HTML_GENERATED:
					previewArea.update(notification.getBody());
				break;
			}
		}
	}
}